package my.mall.db.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author fengbo
 * @since 2024-04-22
 */
@TableName("mall_order")
class Order {

    /**
     * 订单主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    var id: Long? = null

    /**
     * 数据更新时间
     */
    var updatedTime: LocalDateTime? = null

    /**
     * 数据新建时间
     */
    var createdTime: LocalDateTime? = null

    /**
     * 用户主键
     */
    var userId: Long? = null

    /**
     * 订单状态 0-待付款；1-待发货；2-已发货；3-已收货
     */
    var orderStatus: Byte? = null

    /**
     * 实付费用=goods_price+freight_price
     */
    var actualPrice: Int? = null

    /**
     * 付款类型
     */
    var paymentType: String? = null

    /**
     * 付款编号
     */
    var paymentNo: String? = null

    /**
     * 付款时间
     */
    var paymentTime: LocalDateTime? = null

    /**
     * 用户确认收货时间
     */
    var confirmedTime: LocalDateTime? = null

    companion object {

        const val ID : String = "id"


        const val UPDATED_TIME : String = "updated_time"


        const val CREATED_TIME : String = "created_time"


        const val USER_ID : String = "user_id"


        const val ORDER_STATUS : String = "order_status"


        const val ACTUAL_PRICE : String = "actual_price"


        const val PAYMENT_TYPE : String = "payment_type"


        const val PAYMENT_NO : String = "payment_no"


        const val PAYMENT_TIME : String = "payment_time"


        const val CONFIRMED_TIME : String = "confirmed_time"

    }

    override fun toString(): String {
        return "Order{" +
        "id=" + id +
        ", updatedTime=" + updatedTime +
        ", createdTime=" + createdTime +
        ", userId=" + userId +
        ", orderStatus=" + orderStatus +
        ", actualPrice=" + actualPrice +
        ", paymentType=" + paymentType +
        ", paymentNo=" + paymentNo +
        ", paymentTime=" + paymentTime +
        ", confirmedTime=" + confirmedTime +
        "}"
    }
}
